import { ApiProperty } from '@nestjs/swagger';
import { PartialType } from '@nestjs/swagger';
import { Decorator_DtoIsNumber_Base } from '@/common/decorators/dtoIsNumber';
import { IsArray, IsString, IsOptional, IsNotEmpty } from 'class-validator';

export class Role_CreateDto {
  @IsString()
  @IsNotEmpty()
  @ApiProperty({ description: '角色名称' })
  roleName: string;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '角色备注' })
  remark?: string;

  @IsArray()
  @IsOptional()
  @ApiProperty({ description: '菜单ID' })
  menu?: number[];
}

export class Role_FindDto {
  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  size?: number;

  @Decorator_DtoIsNumber_Base()
  @IsOptional()
  page?: number;

  @IsString()
  @IsOptional()
  @ApiProperty({ description: '角色名称' })
  roleName?: string;
}

export class Role_UpdateDto extends PartialType(Role_CreateDto) {
  @Decorator_DtoIsNumber_Base()
  @IsNotEmpty()
  id: number;
}
